Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message for FailureNodeInputMismatch error #2693

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

pingsutw
Copy link
Member

Tracking issue

NA

Why are the changes needed?

The error message is not clear enough.

 /Users/kevin/git/flytekit/flytekit/core/promise.py:1213 in flyte_entity_call_handler             │
│                                                                                                  │
│   1210 │   # Make sure arguments are part of interface                                           │
│   1211 │   for k, v in kwargs.items():                                                           │
│   1212 │   │   if k not in entity.python_interface.inputs:                                       │
│ ❱ 1213 │   │   │   raise AssertionError(f"Received unexpected keyword argument '{k}' in functio  │
│   1214 │                                                                                         │
│   1215 │   # Check if we have more arguments than expected                                       │
│   1216 │   if len(args) > len(entity.python_interface.inputs):                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
AssertionError: Error encountered while executing 't2':
  Received unexpected keyword argument 'b' in function 'failure_node_mismatch_interface.t2'

What changes were proposed in this pull request?

Add a new exception (FlyteFailureNodeInputMismatchException) with a clear error message for this exception.
Use it when the failure node's interface doesn't match the workflow interface.

How was this patch tested?

pyflyte -vv run --remote flyte-example/improve_error/failure_node_mismatch_interface.py

Setup process

from click.testing import CliRunner

from flytekit import task, workflow, ImageSpec
from flytekit.clis.sdk_in_container import pyflyte

default = ["pandas", "mypy"]

image = ImageSpec(registry="pingsutw", packages=[*default])


@task(container_image=image)
def t1() -> int:
    return 3 + 2


@task(container_image=image)
def t2(a: int) -> int:
    return a + 3


@workflow(on_failure=t2)
def wf(a: int = 3, b: str = "hello"):
    t1()
    t2(a=a)

Screenshots

Before:
Screenshot 2024-08-19 at 4 33 40 PM

After:
Screenshot 2024-08-19 at 4 28 31 PM

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

NA

Docs link

NA

Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.60%. Comparing base (a8f68d7) to head (5ca2b60).
Report is 3 commits behind head on master.

Files Patch % Lines
flytekit/core/workflow.py 72.72% 1 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (a8f68d7) and HEAD (5ca2b60). Click for more details.

HEAD has 31 uploads less than BASE
Flag BASE (a8f68d7) HEAD (5ca2b60)
32 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2693      +/-   ##
==========================================
- Coverage   78.91%   71.60%   -7.31%     
==========================================
  Files         316      187     -129     
  Lines       24965    19196    -5769     
  Branches     4012     2773    -1239     
==========================================
- Hits        19702    13746    -5956     
- Misses       4548     4773     +225     
+ Partials      715      677      -38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pingsutw pingsutw merged commit e3036f0 into master Aug 21, 2024
98 of 101 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants